package com.hk.blog.repository.jpa;

import com.hk.blog.domain.UserRole;
import com.hk.core.data.jpa.repository.LongIdJpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Set;

public interface UserRoleRepository extends LongIdJpaRepository<UserRole> {

    void deleteByUserId(Long userId);

    @Query(value = "SELECT  t.roleId FROM UserRole t WHERE t.userId = ?1")
    Set<Long> findRoleIdByUserId(Long userId);
}
